<?
require("config.php");

$label = "Order List";

$table="cus_order";


if ($action=="search"){

	$Query="SELECT 
	id,
	no,
	date,
	contact,
	company 
	FROM $table WHERE 

	no		LIKE '%$Code%'		AND 
	contact		LIKE '%$Name%'		
	ORDER BY id DESC";

	$r=myQuery($Query);

}else{

	$Query="SELECT 
	id,
	no,
	date,
	contact,
	company 
	FROM $table ORDER BY id DESC";

	$r=myQuery($Query);

}

require($rela_path . "inc/header1.php");
?>
<br>
<table width="90%" border="0" align="center">
  <tr> 
    <td>
	
	
	
	
	
	
	
<FORM METHOD=GET ACTION="">		  
		  
<input name="action" type="hidden" value="search">
		  
	
	<table border="0">
        <tr> 
          <td>Search by </td>
          <td>&nbsp;</td>
        </tr>
        <tr> 
          <td>Customer Code :</td>
          <td><input type="text" class="text" name="Code"></td>
        </tr>
        <tr> 
          <td>Customer Name :</td>
          <td><input type="text" class="text" name="Name"></td>
        </tr>
        <tr>
          <td>&nbsp;</td>
          <td><input type="submit" class="button" name="Submit" value="  Go  "></td>
        </tr>
      </table>
</FORM>	  
	  
	  
	  
	  
	  
	  
	  </td>
  </tr>
</table>
<br>
<br>
<table width="90%" border="0" align="center" cellpadding="1" cellspacing="1" class="tb">
  <tr class="tbheader"> 
    <td width="2%"> 
      <div align="center">No.</div>
    </td>
    <td width="10%"> 
      <div align="center">Order No.</div>
    </td>
    <td width="10%"> 
      <div align="center">Date</div>
    </td>
    <td width="19%"> 
      <div align="center">Customer Name</div>
    </td>
    <td width="36%"> 
      <div align="center">Company</div>
    </td>
    <td width="8%"> 
      <div align="center">&nbsp;</div>
    </td>
  </tr>


<?
if ($r){	
	for ($i=0;$i<count($r);$i++){?>
  <tr class="tbcontent1"> 
    <td align="right"><?print($i+1)?></td>
    <td><?print($r[$i][1])?></td>
    <td><?print($r[$i][2])?></td>
    <td align="center"><?print($r[$i][3])?></td>
	<td align="center"><?print($r[$i][4])?></td>
    <td align="center"><a href="customer_order_detail.php?id=<?print($r[$i][0])?>">Detail</a></td>
  </tr>
<?}
}?>


</table>
<br>
<br>
&nbsp;&nbsp; 
<?
require($rela_path . "inc/footer1.php");
?>
